<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{.title}}</title>
    <link rel="stylesheet" href="/static/css/style.css">
</head>
<body>
    <div class="container">
        <header class="admin-header">
            <h1>用户管理</h1>
            <div class="admin-actions">
                <a href="/admin" class="btn-link">说说管理</a>
                <a href="/" class="btn-link">返回首页</a>
                <a href="/admin/logout" class="btn-link">退出登录</a>
            </div>
        </header>

        <div class="users-section">
            <h2>所有用户</h2>
            <div id="usersContainer">
                {{if .users}}
                    {{range .users}}
                    <div class="user-item {{if .IsBanned}}banned{{end}}">
                        <div class="user-main-info">
                            <div class="user-header">
                                <strong>昵称: {{.Nickname}}</strong>
                                {{if .IsBanned}}
                                <span class="banned-badge">已拉黑</span>
                                {{else}}
                                <span class="normal-badge">正常</span>
                                {{end}}
                            </div>
                            <div class="user-details">
                                <div class="user-detail-item">
                                    <span class="label">用户名:</span>
                                    <span class="value">{{.Username}}</span>
                                </div>
                                <div class="user-detail-item">
                                    <span class="label">用户ID:</span>
                                    <span class="value">#{{.ID}}</span>
                                </div>
                                <div class="user-detail-item">
                                    <span class="label">注册时间:</span>
                                    <span class="value">{{.CreatedAt.Format "2006-01-02 15:04"}}</span>
                                </div>
                            </div>
                        </div>
                        <div class="user-actions">
                            <button class="ban-btn" onclick="banUser({{.ID}}, {{if .IsBanned}}true{{else}}false{{end}})">
                                {{if .IsBanned}}取消拉黑{{else}}拉黑{{end}}
                            </button>
                            <button class="delete-user-btn" onclick="deleteUser({{.ID}})">
                                删除用户
                            </button>
                        </div>
                    </div>
                    {{end}}
                {{else}}
                    <div class="empty-message">暂无用户</div>
                {{end}}
            </div>
        </div>
    </div>

    <script src="/static/js/admin.js"></script>
</body>
</html>

